import request from '../../request';
import * as apis from '@shared/apis';

export interface IProductListParams {
    /** 页码 */
    page: number;
    /** 每页数量 */
    pageSize: number;
    /** 搜索关键词 */
    keyword?: string;
    /** 产品分类 */
    category?: string;
    /** 产品品牌 */
    brand?: string;
    /** 产品状态 */
    status?: string;
}

export interface IProductListResponse {
    /** 产品列表数据 */
    items: apis.products.IProduct[];
    /** 分页信息 */
    pagination: {
        page: number;
        pageSize: number;
        total: number;
        totalPages: number;
    };
}

export const post = async (params: IProductListParams): Promise<IProductListResponse> => {
    const res = await request.post('/products/list', params);
    return res.data.data;
}; 